<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Target Virtual Machines</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Target Virtual Machines' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../services.html">Services</a></li><li><a href="index.html">arch</a></li><li><a href="index.html#2">Chapter 2: Architectures and VMs</a></li><li><b>Target Virtual Machines</b></li></ul></div>
<p class="purpose">To deal with multiple object code formats.</p>

<ul class="toc"><li><a href="2-tvm.html#SP1">&#167;1. Target VMs</a></li><li><a href="2-tvm.html#SP5">&#167;5. To and from text</a></li><li><a href="2-tvm.html#SP10">&#167;10. Architectural provisions</a></li><li><a href="2-tvm.html#SP12">&#167;12. File extension provisions</a></li><li><a href="2-tvm.html#SP15">&#167;15. Family compatibility</a></li><li><a href="2-tvm.html#SP16">&#167;16. Options</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Target VMs.</b>For a fuller explanation of these, see <a href="P-wtmd.html" class="internal">What This Module Does</a>, but briefly:
a <a href="2-tvm.html#SP2" class="internal">target_vm</a> object represents a choice of both Inter architecture and
also a format for final code-generation from Inter. For example, it might
represent "16-bit with debugging enabled to be generated to Inform 6 code",
or, say, "32-bit to be generated to ANSI C code".
</p>

<p class="commentary">The basic set of possible target VMs is made when the <a href="index.html" class="internal">arch</a> module starts up:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::create</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::create</span></span>:<br/>Arch Module - <a href="1-am.html#SP3">&#167;3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">void</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="comment-syntax"> hat tip: Joel Berez and Marc Blank, 1979, and later hands</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"5"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"i6"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"z5"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"zblorb"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Parchment"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"5"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"i6"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"z5"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"zblorb"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Parchment"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"8"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"i6"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"z8"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"zblorb"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Parchment"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"8"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"i6"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"z8"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"zblorb"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Parchment"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> hat tip: Andrew Plotkin, 2000</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"3.1.2"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"i6"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ulx"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"gblorb"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Quixe"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"3.1.2"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"i6"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"ulx"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"gblorb"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Quixe"</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> hat tip: modesty forbids</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Binary"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Binary"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Binary"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Binary"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Text"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Text"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Text"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Text"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> C support added September 2021</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"C"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"C"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="comment-syntax"> Inventory support added March 2022</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inventory"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"16d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inventory"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inventory"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"32d"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inventory"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"1"</span><span class="plain-syntax">), </span><span class="identifier-syntax">I</span><span class="string-syntax">"c"</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>The <a href="2-tvm.html#SP2" class="internal">target_vm</a> structure contains two arguably architectural doohickies:
potential limits on the use of floating-point arithmetic or on local variables.
These are indeed currently derived only from the choice of <span class="extract"><span class="extract-syntax">architecture</span></span>, but
we're keeping them here in case there is some day a need for a 32-bit format
with integer-only arithmetic, say.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">architecture</span><span class="plain-syntax">; </span><span class="comment-syntax"> such as 32d</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">semantic_version_number</span><span class="plain-syntax"> </span><span class="identifier-syntax">version</span><span class="plain-syntax">; </span><span class="comment-syntax"> such as 0.8.7</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">transpiled_extension</span><span class="plain-syntax">; </span><span class="comment-syntax"> such as </span><span class="extract"><span class="extract-syntax">i6</span></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM_unblorbed_extension</span><span class="plain-syntax">; </span><span class="comment-syntax"> such as </span><span class="extract"><span class="extract-syntax">z8</span></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM_blorbed_extension</span><span class="plain-syntax">; </span><span class="comment-syntax"> when blorbed up</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM_image</span><span class="plain-syntax">; </span><span class="comment-syntax"> filename of image for icon used in the index</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">default_browser_interpreter</span><span class="plain-syntax">; </span><span class="comment-syntax"> e.g., "Parchment"</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">iFiction_format_name</span><span class="plain-syntax">; </span><span class="comment-syntax"> e.g., "zcode": see the Treaty of Babel</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">transpiler_family</span><span class="plain-syntax">; </span><span class="comment-syntax"> transpiler format, e.g., "Inform6" or "C"</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">full_format</span><span class="plain-syntax">; </span><span class="comment-syntax"> e.g., "Inform6/32d/v3.1.2"</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">supports_floating_point</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">max_locals</span><span class="plain-syntax">; </span><span class="comment-syntax"> upper limit on local variables per stack frame</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format_options</span><span class="plain-syntax">; </span><span class="comment-syntax"> of </span><span class="extract"><span class="extract-syntax">text_stream</span></span>
<span class="plain-syntax">    </span><span class="identifier-syntax">CLASS_DEFINITION</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure target_vm is accessed in 2/cmp and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::new</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::new</span></span>:<br/><a href="2-tvm.html#SP1">&#167;1</a>, <a href="2-tvm.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">arch</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">semantic_version_number</span><span class="plain-syntax"> </span><span class="identifier-syntax">V</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">trans</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">unblorbed</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">blorbed</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">interpreter</span><span class="plain-syntax">, </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">opts</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> = </span><span class="identifier-syntax">CREATE</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">version</span><span class="plain-syntax"> = </span><span class="identifier-syntax">V</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiled_extension</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">trans</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_unblorbed_extension</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">unblorbed</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_blorbed_extension</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">blorbed</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">default_browser_interpreter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">interpreter</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax"> = </span><span class="identifier-syntax">arch</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no such architecture"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-arc.html#SP6" class="function-link"><span class="function-syntax">Architectures::is_16_bit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">supports_floating_point</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">max_locals</span><span class="plain-syntax"> = </span><span class="constant-syntax">15</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_image</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"vm_z8.png"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">supports_floating_point</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">max_locals</span><span class="plain-syntax"> = </span><span class="constant-syntax">256</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_image</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"vm_glulx.png"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iFiction_format_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">format</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-arc.html#SP6" class="function-link"><span class="function-syntax">Architectures::is_16_bit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iFiction_format_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"zcode"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iFiction_format_name</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"glulx"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iFiction_format_name</span><span class="plain-syntax">, </span><span class="string-syntax">"Inform+%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format_options</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_format</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_format</span><span class="plain-syntax">, </span><span class="string-syntax">"%S/%S/v%v"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">, </span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::to_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">), &amp;</span><span class="identifier-syntax">V</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">opts</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">opt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">opt</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">opts</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_format</span><span class="plain-syntax">, </span><span class="string-syntax">"/%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">opt</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">opt</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format_options</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. </b>Plumbing is included here to add "options" to a VM's textual description. The
idea is that these allow for the user to specify additional and VM-specific
command-line options (using <span class="extract"><span class="extract-syntax">-format</span></span>) which are then picked up by <a href="../final-module/index.html" class="internal">final</a>.
Thus, a request for <span class="extract"><span class="extract-syntax">-format=C/32d/no-halt/stack=240</span></span> would cause a new variant of
<span class="extract"><span class="extract-syntax">C/32d</span></span> to be created which would have the (purely hypothetical) list of
options <span class="extract"><span class="extract-syntax">I"no-halt", I"stack=240"</span></span>. It is then up to the C final code generator
to understand what these mean, if indeed they mean anything.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::new_variant</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::new_variant</span></span>:<br/><a href="2-tvm.html#SP6_3">&#167;6.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">existing</span><span class="plain-syntax">, </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">opts</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-tvm.html#SP3" class="function-link"><span class="function-syntax">TargetVMs::new</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">, </span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">version</span><span class="plain-syntax">, </span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiled_extension</span><span class="plain-syntax">, </span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_unblorbed_extension</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_blorbed_extension</span><span class="plain-syntax">, </span><span class="identifier-syntax">existing</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">default_browser_interpreter</span><span class="plain-syntax">, </span><span class="identifier-syntax">opts</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. To and from text.</b>First, writing. This is the longhand form of the VM name:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::write</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::write</span></span>:<br/>Compatibility - <a href="2-cmp.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"none"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_full_format_text</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">full_format</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>And now for reading. The following is used by <a href="../inbuild/index.html" class="internal">inbuild</a> when reading the
command-line option <span class="extract"><span class="extract-syntax">-format=T</span></span>: the text <span class="extract"><span class="extract-syntax">T</span></span> is supplied as a parameter here.
</p>

<p class="commentary">Note however that it actually calls <a href="2-tvm.html#SP6" class="internal">TargetVMs::find_with_hint</a>. The <span class="extract"><span class="extract-syntax">debug</span></span>
hint, if set, says to make the architecture have debugging enabled or not according
to this hint: thus <span class="extract"><span class="extract-syntax">"C"</span></span> plus the hint <span class="extract"><span class="extract-syntax">FALSE</span></span> will return the VM <span class="extract"><span class="extract-syntax">C/32</span></span>, while
<span class="extract"><span class="extract-syntax">"C"</span></span> plus the hint <span class="extract"><span class="extract-syntax">TRUE</span></span> will return the VM <span class="extract"><span class="extract-syntax">C/32d</span></span>. The hint <span class="extract"><span class="extract-syntax">NOT_APPLICABLE</span></span>
is ignored; and the hint is also ignored if the supplied text already definitely
specifies debugging. Thus <span class="extract"><span class="extract-syntax">"C/32d"</span></span> plus hint <span class="extract"><span class="extract-syntax">FALSE</span></span> will return <span class="extract"><span class="extract-syntax">C/32d</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::find</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-tvm.html#SP6" class="function-link"><span class="function-syntax">TargetVMs::find_with_hint</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">format</span><span class="plain-syntax">, </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">); </span><span class="comment-syntax"> i.e., no hint</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::find_with_hint</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">debug</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">format</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">format</span><span class="plain-syntax"> = </span><span class="identifier-syntax">I</span><span class="string-syntax">"Inform6"</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">wanted_language</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">semantic_version_number</span><span class="plain-syntax"> </span><span class="identifier-syntax">wanted_version</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VersionNumbers::null</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">wanted_opts</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NEW_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-tvm.html#SP6_1" class="named-paragraph-link"><span class="named-paragraph">Parse the text supplied into these variables</span><span class="named-paragraph-number">6.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-arc.html#SP6" class="function-link"><span class="function-syntax">Architectures::debug_enabled</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax">))) </span><span class="identifier-syntax">debug</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-tvm.html#SP6_2" class="named-paragraph-link"><span class="named-paragraph">Try to find a VM which is a perfect match</span><span class="named-paragraph-number">6.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-tvm.html#SP6_3" class="named-paragraph-link"><span class="named-paragraph">Try to find a VM which would be a match except for the options</span><span class="named-paragraph-number">6.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="2-tvm.html#SP6_4" class="named-paragraph-link"><span class="named-paragraph">Try to find a VM in the now-deprecated old notation</span><span class="named-paragraph-number">6.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP6_1" class="paragraph-anchor"></a><b>&#167;6.1. </b>Format text is a list of criteria divided by slashes:
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse the text supplied into these variables</span><span class="named-paragraph-number">6.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">format</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) == </span><span class="character-syntax">'/'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="2-tvm.html#SP6_1_1" class="named-paragraph-link"><span class="named-paragraph">Accept criterion</span><span class="named-paragraph-number">6.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">Str::clear</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">, </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">) &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="2-tvm.html#SP6_1_1" class="named-paragraph-link"><span class="named-paragraph">Accept criterion</span><span class="named-paragraph-number">6.1.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">)</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-tvm.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_1_1" class="paragraph-anchor"></a><b>&#167;6.1.1. </b>The first criterion is the only compulsory one, and must be something like
<span class="extract"><span class="extract-syntax">Inform6</span></span> or <span class="extract"><span class="extract-syntax">C</span></span>. After that, any criterion in the form of an architecture code,
like <span class="extract"><span class="extract-syntax">32d</span></span>, is interpreted as such; and any criterion opening with <span class="extract"><span class="extract-syntax">v</span></span> plus a
digit is read as a semantic version number. If any criteria are left after all
that, they are considered options (see above).
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Accept criterion</span><span class="named-paragraph-number">6.1.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">wanted_language</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">wanted_language</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">arch</span><span class="plain-syntax"> = </span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::from_codename_with_hint</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">, </span><span class="identifier-syntax">debug</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">arch</span><span class="plain-syntax">) </span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax"> = </span><span class="identifier-syntax">arch</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (((</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">) == </span><span class="character-syntax">'v'</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">) == </span><span class="character-syntax">'V'</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">Characters::isdigit</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">)))) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">Str::delete_first_character</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">wanted_version</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VersionNumbers::from_text</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">ADD_TO_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::duplicate</span><span class="plain-syntax">(</span><span class="identifier-syntax">criterion</span><span class="plain-syntax">), </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_opts</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-tvm.html#SP6_1">&#167;6.1</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP6_2" class="paragraph-anchor"></a><b>&#167;6.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Try to find a VM which is a perfect match</span><span class="named-paragraph-number">6.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_language</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            ((</span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax"> == </span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            ((</span><span class="identifier-syntax">debug</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">) || (</span><a href="2-tvm.html#SP10" class="function-link"><span class="function-syntax">TargetVMs::debug_enabled</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) == </span><span class="identifier-syntax">debug</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="2-tvm.html#SP8" class="function-link"><span class="function-syntax">TargetVMs::versions_match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_version</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="2-tvm.html#SP9" class="function-link"><span class="function-syntax">TargetVMs::options_match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_opts</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">result</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-tvm.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6_3" class="paragraph-anchor"></a><b>&#167;6.3. </b>If we're given, say, <span class="extract"><span class="extract-syntax">C/32d/no-pointer-nonsense</span></span> and we can't find that exact
thing, but can find <span class="extract"><span class="extract-syntax">C/32d</span></span>, then we construct a variant of it which does have
the option <span class="extract"><span class="extract-syntax">no-pointer-nonsense</span></span> and return that.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Try to find a VM which would be a match except for the options</span><span class="named-paragraph-number">6.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_language</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            ((</span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax"> == </span><span class="identifier-syntax">wanted_arch</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            ((</span><span class="identifier-syntax">debug</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NOT_APPLICABLE</span><span class="plain-syntax">) || (</span><a href="2-tvm.html#SP10" class="function-link"><span class="function-syntax">TargetVMs::debug_enabled</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) == </span><span class="identifier-syntax">debug</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="2-tvm.html#SP8" class="function-link"><span class="function-syntax">TargetVMs::versions_match</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_version</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-tvm.html#SP4" class="function-link"><span class="function-syntax">TargetVMs::new_variant</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">result</span><span class="plain-syntax">, </span><span class="identifier-syntax">wanted_opts</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-tvm.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. </b>If we get here, we've failed to make any match using the modern notation.
</p>

<p class="commentary">So next we try to deduce a VM from the given filename extension, which is the
clumsy way that VMs used to be referred to on the <a href="../inform7/index.html" class="internal">inform7</a> command line. For
example, <span class="extract"><span class="extract-syntax">-format=ulx</span></span> produces <span class="extract"><span class="extract-syntax">Inform6/32</span></span> or <span class="extract"><span class="extract-syntax">Inform6/32d</span></span> (depending on
the <span class="extract"><span class="extract-syntax">debug</span></span> hint).
</p>

<p class="commentary firstcommentary"><a id="SP6_4" class="paragraph-anchor"></a><b>&#167;6.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Try to find a VM in the now-deprecated old notation</span><span class="named-paragraph-number">6.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::copy</span><span class="plain-syntax">(</span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">, </span><span class="identifier-syntax">format</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">) == </span><span class="character-syntax">'.'</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Str::delete_first_character</span><span class="plain-syntax">(</span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">Str::put</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">Characters::tolower</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">)));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="reserved-syntax">target_vm</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_unblorbed_extension</span><span class="plain-syntax">, </span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">            (</span><a href="2-tvm.html#SP10" class="function-link"><span class="function-syntax">TargetVMs::debug_enabled</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) == </span><span class="identifier-syntax">debug</span><span class="plain-syntax">))</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">result</span><span class="plain-syntax"> = </span><span class="identifier-syntax">VM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">file_extension</span><span class="plain-syntax">)</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">result</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">STDOUT</span><span class="plain-syntax">, </span><span class="string-syntax">"(-format=%S is deprecated: try -format=%S/%S instead)\n"</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">format</span><span class="plain-syntax">, </span><span class="identifier-syntax">result</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><a href="2-arc.html#SP5" class="function-link"><span class="function-syntax">Architectures::to_codename</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">result</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">result</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="2-tvm.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. </b>Semantic version rules apply if the user supplies a format text with a given
version requirement. If the user asks for <span class="extract"><span class="extract-syntax">v3.1.0</span></span> and we've got <span class="extract"><span class="extract-syntax">v3.1.2</span></span>,
no problem: there's a match. But <span class="extract"><span class="extract-syntax">v2.9.3</span></span> or <span class="extract"><span class="extract-syntax">3.2.1</span></span> would not match.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::versions_match</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::versions_match</span></span>:<br/><a href="2-tvm.html#SP6_2">&#167;6.2</a>, <a href="2-tvm.html#SP6_3">&#167;6.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">semantic_version_number</span><span class="plain-syntax"> </span><span class="identifier-syntax">wanted</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VersionNumbers::is_null</span><span class="plain-syntax">(</span><span class="identifier-syntax">wanted</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VersionNumberRanges::in_range</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">version</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">VersionNumberRanges::compatibility_range</span><span class="plain-syntax">(</span><span class="identifier-syntax">wanted</span><span class="plain-syntax">))) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>That just leaves how to tell whether or not a VM has exactly the right options,
given that (a) there can be any number of them, including 0, and (b) they can
be specified in any order. Speed is unimportant here: in effect we test whether
two lists of options give rise to sets which are subsets of each other.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::options_match</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::options_match</span></span>:<br/><a href="2-tvm.html#SP6_2">&#167;6.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">supplied</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><a href="2-tvm.html#SP9" class="function-link"><span class="function-syntax">TargetVMs::ll_of_text_is_subset</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">supplied</span><span class="plain-syntax">, </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format_options</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="2-tvm.html#SP9" class="function-link"><span class="function-syntax">TargetVMs::ll_of_text_is_subset</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format_options</span><span class="plain-syntax">, </span><span class="identifier-syntax">supplied</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::ll_of_text_is_subset</span><span class="plain-syntax">(</span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">, </span><span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">opt</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">opt</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">opt2</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_OVER_LINKED_LIST</span><span class="plain-syntax">(</span><span class="identifier-syntax">opt2</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax">, </span><span class="identifier-syntax">B</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">opt</span><span class="plain-syntax">, </span><span class="identifier-syntax">opt2</span><span class="plain-syntax">)) </span><span class="identifier-syntax">found</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">found</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Architectural provisions.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::is_16_bit</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::is_16_bit</span></span>:<br/><a href="2-tvm.html#SP11">&#167;11</a><br/>Compatibility - <a href="2-cmp.html#SP10_2">&#167;10.2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-arc.html#SP6" class="function-link"><span class="function-syntax">Architectures::is_16_bit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::debug_enabled</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::debug_enabled</span></span>:<br/><a href="2-tvm.html#SP6_2">&#167;6.2</a>, <a href="2-tvm.html#SP6_3">&#167;6.3</a>, <a href="2-tvm.html#SP6_4">&#167;6.4</a><br/>Compatibility - <a href="2-cmp.html#SP10_1">&#167;10.1</a>, <a href="2-cmp.html#SP10_2">&#167;10.2</a>, <a href="2-cmp.html#SP10_3">&#167;10.3</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-arc.html#SP6" class="function-link"><span class="function-syntax">Architectures::debug_enabled</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::supports_floating_point</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">supports_floating_point</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::allow_this_many_locals</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">max_locals</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">max_locals</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">N</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::has_architecture</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::has_architecture</span></span>:<br/>Compatibility - <a href="2-cmp.html#SP12">&#167;12</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="identifier-syntax">A</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">A</span><span class="plain-syntax"> == </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. </b>This function is only called to decide whether to issue certain ICL memory
settings to the Inform 6 compiler, and so we can basically assume the VM here
is going to end up as either the Z-machine or Glulx.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::allow_memory_setting</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">setting</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">setting</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"MAX_LOCAL_VARIABLES"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">max_locals</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">15</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">setting</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"DICT_CHAR_SIZE"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-tvm.html#SP10" class="function-link"><span class="function-syntax">TargetVMs::is_16_bit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">setting</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"DICT_WORD_SIZE"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-tvm.html#SP10" class="function-link"><span class="function-syntax">TargetVMs::is_16_bit</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. File extension provisions.</b>The normal or unblorbed file extension is just a hint for what would make a
natural filename for our output: for example, <span class="extract"><span class="extract-syntax">py</span></span> would be a natural choice
for a Python VN, if there were one.
</p>

<p class="commentary">When releasing a blorbed story file, the file extension used depends on the
story file wrapped inside. (This is a dubious idea, in the opinion of
the author of Inform &mdash; should not "blorb" be one unified wrapper? &mdash; but
that ship seems to have sailed.)
</p>

<p class="commentary">Note that for VMs not using Inform 6, blorbing is essentially meaningless,
and then the blorbed extension may be the empty text.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_transpiled_extension</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiled_extension</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_unblorbed_extension</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_unblorbed_extension</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_blorbed_extension</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">VM_blorbed_extension</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. </b>This is the format name as expressed in an iFiction bibliographic record,
where it's not meaningful to talk about debugging features or the number
of bits, and where it's currently not possible to express a VM version number.
</p>

<p class="commentary">It's also unclear what to write to this if we're compiling, say, an Inform 7
source text into C: the Treaty of Babel is unclear on that. For now, we write
<span class="extract"><span class="extract-syntax">Inform7+C</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_iFiction_format</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iFiction_format_name</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_architecture</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_architecture</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">architecture</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP14" class="paragraph-anchor"></a><b>&#167;14. </b>Different VMs have different in-browser interpreters, which means that
<a href="../inblorb/index.html" class="internal">inblorb</a> needs to be given different release instructions for them. If the
user doesn't specify any particular interpreter, she gets the following.
</p>

<p class="commentary">On some platforms this will make no sense, and in those cases the function
will return the empty text.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::get_default_interpreter</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">default_browser_interpreter</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP15" class="paragraph-anchor"></a><b>&#167;15. Family compatibility.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::family</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::family</span></span>:<br/>Compatibility - <a href="2-cmp.html#SP10_4">&#167;10.4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TargetVMs::compatible_with</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">TargetVMs::compatible_with</span></span>:<br/>Compatibility - <a href="2-cmp.html#SP10_1">&#167;10.1</a>, <a href="2-cmp.html#SP10_3">&#167;10.3</a>, <a href="2-cmp.html#SP10_4">&#167;10.4</a>, <a href="2-cmp.html#SP10_5">&#167;10.5</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">token</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq_insensitive</span><span class="plain-syntax">(</span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">transpiler_family</span><span class="plain-syntax">, </span><span class="identifier-syntax">token</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP16" class="paragraph-anchor"></a><b>&#167;16. Options.</b>Final code-generators can call this to see what special requests were made.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="identifier-syntax">linked_list</span><span class="plain-syntax"> *</span><span class="function-syntax">TargetVMs::option_list</span><span class="plain-syntax">(</span><span class="reserved-syntax">target_vm</span><span class="plain-syntax"> *</span><span class="identifier-syntax">VM</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">VM</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no VM"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">VM</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">format_options</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="2-arc.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-am.html">1</a></li><li class="progresscurrentchapter">2</li><li class="progresssection"><a href="2-arc.html">arc</a></li><li class="progresscurrent">tvm</li><li class="progresssection"><a href="2-cmp.html">cmp</a></li><li class="progresschapter"><a href="3-fm.html">3</a></li><li class="progressnext"><a href="2-cmp.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

